﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace VmcRemote.Common
{
    [global::System.AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)]
    public sealed class DescriptionAttribute : Attribute
    {
        // This is a positional argument
        public DescriptionAttribute(string text)
        {
            this.Text = text;
        }

        public string Text { get; private set; }

        public static string GetTypeDescription(Type type)
        {
            object[] attrs = type.GetCustomAttributes(typeof(DescriptionAttribute), false);
            if (attrs != null && attrs.Length > 0)
                return ((DescriptionAttribute)attrs[0]).Text;
            return type.Name;
        }
    }
}
